package DEC;

import Components.EthernetSwitch;
import Components.IBSwitch;
import Configuration.ConfLiterals;
import Configuration.configuration;
/**
 *
 * @author mgrutman
 */
class MyExecuter
{
    public void myRun (String command)
    {
        if(command.equals("DefaultConfiguration"))
        {
            IBSwitch.process(4, false);
            EthernetSwitch.process(4,false);
        }
        
        if(command.equals("InteractiveConfiguration"))
        {
            System.out.println("Trying to configure system interactively.\n");
            System.out.println("Please enter total number of engines in system : "); 
            int numEngines = Integer.parseInt(DEC.readInput());
            engineConfigurationMenu(numEngines);
            int choice = Integer.parseInt(DEC.readInput());
            
            IBSwitch.process(numEngines, true);
            EthernetSwitch.process(numEngines, true);
        }
    }
     
    public void engineConfigurationMenu(int numEngines)
        {
            System.out.println("Engine configuration type( engine division)");
            if(numEngines == 4)
            {
                for(int i = 0 ; i < 4; i ++ )
                {
                    System.out.println(ConfLiterals.conf[i][1] + "( "+ ConfLiterals.conf[i][3]+").");
                }
            }
            
            if(numEngines == 8)
            {
                for(configuration x: configuration.values())
                {
                    System.out.println(ConfLiterals.conf[x.ordinal()][1] + "( "+ ConfLiterals.conf[x.ordinal()][0]+").");
                }
            }
        }
}
